<template>
  <div>
    <div :style="{width: '100%', height: ($window.height-60)+'px'}">
      <el-carousel style="height:100%;" :interval="4000">
        <el-carousel-item :style="{width: '100%', height: ($window.height-60)+'px'}" v-for="item in newsPics" :key="item.img">
          <div @click="imgLink(item.link)" style="width: 100%; height: 100%;">
            <el-image :title="item.title" :src="item.img" :fit="imgFitType"
                      style="width: 100%; height: 100%;">
              <h3 class="small">{{ item.text }}</h3>
            </el-image>
          </div>
        </el-carousel-item>
      </el-carousel>
    </div>
  </div>
</template>
<script>

export default {
  components:{
  },
  data() {
    //TODO 初始化Nginx指定图片服务路径下的资源
    return {
      newsPics: [
        {title: "", img: "../../static/img/carousel-paper.jpg", link: "#"},
        {title: "", img: "../../static/img/carousel-journal.jpg", link: "#"},
        {title: "", img: "../../static/img/carousel-lecture.jpg", link: "#"},
      ],
      imgFitType: "fill",
      geoDatas: [],
      newPapers: [],
      newJournals: [],
      newLectures: [],
    }
  },
  methods: {
    //TODO 首页图片跑马灯跳转至详情页
    imgLink(link) {
      this.$router.push(link);
    },
    showPaperDetail() {
      this.$router.push('/academia/paper');
    },
    showJournalDetail() {
      this.$router.push('/academia/journal');
    },
    showLectureDetail() {
      this.$router.push('/academia/lecture');
    },
    showGeoDetail() {
      this.$router.push('/spaceData');
    },
  },
  computed: {},
  mounted() {
  }
}
</script>

<style scoped>
.el-carousel__item h3 {
  color: white;
  font-size: 14px;
}

.el-carousel__container {
  position: relative;
  height: 100% !important;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}

.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both
}
</style>
